package leetcode;

/***
 * 链接：https://leetcode.cn/problems/divisor-game/
 * 题目：除数博弈
 * 思路：动态规划
 */
public class DivisorGame {
    public static void main(String[] args) {
        int n = 5;
        System.out.println(divisorGame(n));
    }
    public static boolean divisorGame(int n) {
        boolean[] f = new boolean[n + 5];
        f[1]=true;
        f[2]=true;
        for (int i = 3; i <= n; i++) {
            for (int j = 1; j < n; j++) {
                if (i % j == 0 && !f[i - j]) {
                    f[i] = true;
                    break;
                }
            }
        }
        return f[n];
    }
}
